import request from '@/utils/request'
import setting from '@/settings.js'
let Base64 = require('js-base64').Base64;
// 登录方法
export function login(username, password, code, uuid, auth_type) {
  const data = {
    username,
    password,
    code,
    uuid,
    auth_type,
    grant_type: 'password'
  }
  return request({
    url: '/oauth/token',
    method: 'post',
    params: data,
    headers: {
      'Authorization': 'basic ' + Base64.encode(setting.clientId + ":" + setting.clientSecret)
    } //设置header信息
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/login/info',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/oauth/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/login/vcc/image',
    method: 'get'
  })
}
